﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Boiling.BizFacade;

namespace Boiling.Web
{
    public partial class SearchFriend : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session.Contents["userID"] == null)
            {
                Response.Redirect("default.aspx");
            }
            if (IsPostBack)
            {
                string m_FriendName;
                int m_FriendCount;
                c_UserInfo [] m_Result;

                FriendManager m_friend = new FriendManager();
                m_FriendName = Request.Form["FriendName"];
                m_FriendCount = m_friend.GetUsersCountbyUsername(m_FriendName);
                m_Result = m_friend.GetUserInfoDataByUsernameReturnClass(m_FriendName);
                if (Session.Contents["StringName"] == null)
                {
                    Session.Add("String", m_FriendName);
                    Session.Add("UserInfo", m_Result);
                    Session.Add("StringCount", m_FriendCount);
                }
                else
                {
                    Session.Contents["StringEmail"] = m_Result;
                    Session.Contents["StringCount"] = m_FriendCount;
                }
            }
        }
        public void LinkButton_Click(Object sender, EventArgs e)
        {

            if (Session.Contents["userID"] != null)
            {
                Session.Remove("userID");
            }
            Response.Redirect("Default.aspx");
        }
    }
}
